package com.tiheima.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Slf4j
// @Aspect
// @Component
public class LogAspect {

    @Pointcut(value = "@annotation(com.tiheima.aop.anno.LogAnno)")
    public void pc(){}

    @Before("pc()")
    public void setLog(JoinPoint jp){
        Object[] args = jp.getArgs();
        String name = jp.getSignature().getName();
        log.info("方法名:{},参数:{}",name,args);
    }
}
